/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:何人亮
 * Date:2024-12-16
 * 22:17
 */
public class Test {
    public static void main(String[] args) {
        boolean b=isHappy(2);
        System.out.println(b);
    }
    public static int Bigsum( int n){
        int sum=0;
        while(n!=0){
            sum+=(n%10)*(n%10);
            n/=10;
        }
        return sum;
    }
    public static boolean isHappy(int n){
        int slow=n;
        int fast=Bigsum(n);
        while(slow!=fast){
            slow=Bigsum(slow);
            fast=Bigsum(Bigsum(fast));
        }
        return slow==1;
    }
}
